package zisu.algorithm.algorithm.MaxHeap;

import com.sun.org.apache.bcel.internal.generic.BREAKPOINT;

import java.util.Arrays;
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        int n = 1000;
        Random random = new Random();
        MaxHeap<Integer> maxHeap = new MaxHeap<>();
        for(int i=0;i<n;i++){
            maxHeap.add(random.nextInt(Integer.MAX_VALUE));
        }

        int[] list = new int[n];
        for(int i=0;i<n;i++){
            list[i] = maxHeap.extractMax();
        }

        for(int i=1 ; i<n ; i++){
            if(list[i-1]<list[i]){
                System.err.println("参数错误");
                break;
            }
        }
        for(int i:list){
            System.out.println(i);
        }
        System.out.println("排序成功");
    }
}
